﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Net;
using System.IO;
using System.Xml.Serialization;
using System.Xml;

namespace Adams.Public.Web.Controllers
{
    [EnsureSsl]
    public class DonateController : Controller
    {
        [AppendLayoutViewModel]
        public ActionResult Index()
        {
            var model = Business.Web.Donate.Index.PageLoad();
            model.IsLoggedIn = User.Identity.IsAuthenticated;
            return View(model);
        }

        [AppendLayoutViewModel]
        public ActionResult Payment(string b)
        {
            var model = Business.Web.Donate.Payment.PageLoad();
            model.BucketID = b;
            return View(model);
        }

        public JsonResult SavePayment(Adams.Public.DataTransfer.Web.Donate.Payment.FormInput input)
        {
            var model = Adams.Public.Web.Business.Web.Donate.Payment.Save(input);
            return Json(model);
        }

        [AppendLayoutViewModel]
        public ActionResult Confirm(string d)
        {
            var model = Adams.Public.Web.Business.Web.Donate.Confirm.PageLoad(d);
            return View(model);
        }

        public JsonResult ConfirmDonation(Adams.Public.DataTransfer.Web.Donate.Confirm.FormInput input)
        {
            var model = Adams.Public.Web.Business.Web.Donate.Confirm.ConfirmDonation(input);
            return Json(model);
        }

        [AppendLayoutViewModel]
        public ActionResult ThankYou()
        {
            return View();
        }
    }
}
